package com.ptu.spzx.service.impl;


import com.ptu.spzx.utils.SecurityUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionService {
    public boolean hasPermission(String permission){
        if(SecurityUtils.isAdmin()){
            List<String> permissions=SecurityUtils.getLoginUser().getPermission();
            System.out.println("======================");
            System.out.println(permissions.contains(permission));
            return true;
        }
        List<String> permissions=SecurityUtils.getLoginUser().getPermission();
        if(permissions==null)
            return false;
        return permissions.contains(permission);
    }
}
